from setuptools import setup, find_packages
from glob import glob

import sys
import os
cwd = os.getcwd()

def find_name():
   return cwd.split(os.sep)[-1]

def find_version():
   root = cwd+os.sep+'dist'
   if os.path.exists( root ):
      print [os.path.basename(f) for f in glob(root+os.sep+'*.egg')]
      return raw_input('pick a version:') or sys.exit()
   return '0.1'

name = find_name()
version = find_version()
packages = find_packages()

print name, version, packages

if raw_input('make an egg? y[n]:').lower().startswith('y'):
   setup(name = name,
         version = version,
         packages = packages)
